package com.xszx.knowledge.controller;


import com.xszx.knowledge.service.EbookSnapshotService;
import com.xszx.knowledge.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 电子书快照表 前端控制器
 * </p>
 *
 * @author wencai
 * @since 2023/05/06 14:13
 */
@Api(tags = "首页统计")
@RestController
@RequestMapping("/ebook-snapshot")
public class EbookSnapshotController {
    @Resource
    private EbookSnapshotService ebookSnapshotService;

    /**
     * 查询总阅读数、总点赞数、今日阅读数、今日点赞数、
     * @return
     */
    @ApiOperation("统计首页基础数据")
    @GetMapping("/getTopStatistic")
    public Result getTopStatistic(){
        return Result.ok(ebookSnapshotService.getTopStatistic());
    }
    /**
     * 查询30天内容的数据
     * @return
     */
    @ApiOperation("统计首页折线图数据")
    @GetMapping("/getThirtyStatistic")
    public Result getThirtyStatistic(){
        return Result.ok(ebookSnapshotService.getThirtyStatistic());
    }
}
